package com.workflow.workflowproject.config;

import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.info.License;
import org.apache.logging.log4j.LogManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
import static cn.hutool.core.lang.Console.log;

/**
 * <p>文档配置类</p>
 *
 * @author By: chegnxuyanshitang
 * Package com.demo2.config
 * Ceate Time 2024-04-22 10:25
 */
@Configuration
public class Swagger3Config extends WebMvcConfigurationSupport {
    private static final org.apache.logging.log4j.Logger log = LogManager.getLogger(MyBatisFlexConfiguration.class);
    /**
     * 设置静态资源映射
     *
     * @param registry
     */
    protected void addResourceHandlers (ResourceHandlerRegistry registry) {
        registry.addResourceHandler ("/doc.html").addResourceLocations ("classpath:/META-INF/resources/");
        registry.addResourceHandler ("/webjars/**").addResourceLocations ("classpath:/META-INF/resources/webjars/");
    }

    @Bean
    public OpenAPI apiInfo () {
        log.info(">>>>>>>>>>>>Swagger3 配置>>>>>>>>>>>>");
        return new OpenAPI ()
                .info (new Info ()
                        .title ("翻山鸣研发项目")
                        .version ("1.0.0")
                        .description ("翻山鸣研发项目文档接口")
                        .license (new License ().name ("Apache 2.0")
                        .url ("http://www.yang.com/"))
                );
    }
}
